<template>
  <basic-container :btnFlag=true>
    <div class="card-border">
      <card-header :header-data="headerData"></card-header>
      <div style="margin-left: 9px;margin-top: -38px;">
        <bostech-detail :detail-data="detailData"></bostech-detail>
      </div>
      <div style="float: right;margin-top: -124px;margin-right: 31px;">
        <el-button type="primary" size="mini" @click.stop="resultDetailTemp()">查看规划详情</el-button>
      </div>
    </div>
  </basic-container>
</template>

<script>
  import {getSubjectInfo} from "@/api/subject";
  import {resultDetail} from "@/api/planning/result";
  import {getNotNull} from '@/views/util'

  export default {
    name: "subjectDetail",
    created() {
      this.putSubjectForm();
    },
    data() {
      return {
        headerData: {
          title: '课题详情'
        },
        detailData: [],
        subjectForm: {
          title: '',
          description: '',
        },
        achievementIdTemp: 0,
      }
    },
    methods: {
      async putSubjectForm() {
        await getSubjectInfo(this.$route.params.id).then(response => {
          this.subjectForm.title = response.data.data.title;
          this.subjectForm.description = response.data.data.description;
          this.achievementIdTemp = response.data.data.achievementId;
          var records = response.data.data;
          this.detailData = [
            {label: '课题名称', value: getNotNull(records.title)},
            {label: '创建时间', value: getNotNull(records.createTime)},
            {label: '课题概述', value: getNotNull(records.description)},
          ]
        });
        resultDetail(this.achievementIdTemp).then(response => {
          this.detailData.push({label: '规划名称', value: getNotNull(response.data.data.title)});
          this.detailData.push({label: '规划编码', value: getNotNull(response.data.data.pmuc)});
        })
      },
      // 成果详情跳转
      resultDetailTemp() {
        let src = `/searchDetail/detail/${this.achievementIdTemp}`;
        this.$router.push({
          path: src
        })
      },
    }
  }
</script>


<style lang="scss" scoped>
  .card-border {
    border: 1px solid #d2d2d2;
    padding: 12px;
    min-height: 400px;
  }

  /deep/ .avue-crud__menu {
    min-height: 1px;
  }
</style>
